/*
 *  Calculate the result of string expression
 *  Sample input:
 *  (1+3.14*4)/2+2.7^2
 *  Sample output:
 *  ans = 14.07
 */

/*-------- Includes --------*/
#include <list>
#include <stack>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <iostream>

using namespace std;

/*-------- Defines --------*/


/*-------- Types --------*/
enum TYPE {
    OPERATOR, OPERAND
};

struct Node {
    TYPE   t;
    int    opt;
    double opd;

    Node(int opt)    : t(OPERATOR), opt(opt) {}
    Node(double opd) : t(OPERAND),  opd(opd) {}
};

/*-------- Global Variables --------*/


/*-------- Function Prototypes --------*/
bool isDigit(char c);
int oRank(char c);

/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    string s;

    while (cin >> s) {
        stack<char> stk;
        list<Node>  post;

        int i = 0, j;
        int l = s.length();

        // convert infix expression to postfix
        while (i < l) {
            if (isDigit(s[i])) {
                j = i;

                while (isDigit(s[++j]));

                post.push_back(Node(atof(s.substr(i, j - i).c_str())));

                i = j - 1;
            } else if (s[i] == '(') {
                stk.push(s[i]);
            } else if (s[i] == ')') {
                while (stk.top() != '(') {
                    post.push_back(Node(stk.top()));
                    stk.pop();
                }
                stk.pop();
            } else {
                while (!stk.empty()) {
                    if (oRank(stk.top()) < oRank(s[i]))
                        break;

                    post.push_back(Node(stk.top()));
                    stk.pop();
                }

                stk.push(s[i]);
            }

            i++;
        }

        while (!stk.empty()) {
            post.push_back(Node(stk.top()));
            stk.pop();
        }

        // calculate
        stack<double> nstk;
        for (list<Node>::iterator it = post.begin(); it != post.end(); ++it) {
            if (it->t == OPERATOR) {
                double b = nstk.top(); nstk.pop();
                double a = nstk.top(); nstk.pop();
                double c;

                switch (it->opt) {
                    case '+': c = a + b;       break;
                    case '-': c = a - b;       break;
                    case '*': c = a * b;       break;
                    case '/': c = a / b;       break;
                    case '^': c = pow(a, b); break;
                    default : break;
                }

                nstk.push(c);
            } else {
                nstk.push(it->opd);
            }
        }

        double r = nstk.top(); nstk.pop();

        cout << fixed << setprecision(2) << "ans = " << r << endl;
    }

    return 0;
}

/*-------- Functions --------*/
bool isDigit(char c)
{
    return isdigit(c) || c == '.';
}

int oRank(char c)
{
    switch (c) {
        case '+':
        case '-': return 1;
        case '*':
        case '/': return 2;
        case '^': return 3;
        default:  return 0;
    }
}
